using Wolfpack.Core;
using Wolfpack.Core.Configuration;
using Wolfpack.Core.Interfaces.Entities;
using Wolfpack.Core.Notification.Filters.Request;

namespace Wolfpack.Contrib.BuildAnalytics.Checks.TeamCity
{
    public class TeamCityBuildNotificationConfigurationDiscovery : HealthCheckDiscoveryBase<TeamCityBuildNotificationCheckConfig, TeamCityBuildNotificationCheck>
    {
        protected override TeamCityBuildNotificationCheckConfig GetConfiguration()
        {
            return new TeamCityBuildNotificationCheckConfig
                       {
                           BuildServerUrl = "CHANGEME!",
                           ProjectName = "CHANGEME!",
                           ConfigurationName = "CHANGEME!",
                           Enabled = true,
                           FriendlyId = "CHANGEME!",
                           NotificationMode = AlwaysPublishNotificationFilter.FilterName,
                           UserId = "Server Credentials or blank",
                           Password = "Server Credentials or blank",
                           TrustDuffSslCertificate = true,
                           UseSsl = false
                       };
        }

        protected override void Configure(ConfigurationEntry entry)
        {
            entry.Name = "TeamCityBuildNotificationCheck";
            entry.Description = "This check will monitor a TeamCity Project BuildConfiguration for new builds and raises notifications" +
                                " based on the build success";
            entry.Tags.AddIfMissing("TeamCity", "CI");
        }
    }
}